package com.yuyue.dronesystem.beans;

import java.util.Objects;

/**
 * Coordinate
 */
public class Coordinate {

    // 经度（0-180°）
    private Double longitude = 0.0;
    // 纬度（0-90°）
    private Double latitude = 0.0;
    // 高度（英寸）
    private Double altitude = 0.0;

    public Coordinate() {
    }

    public Coordinate(Double longitude, Double latitude, Double altitude) {
        this.longitude = longitude;
        this.latitude = latitude;
        this.altitude = altitude;
    }

    public Double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public Double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getAltitude() {
        return this.altitude;
    }

    public void setAltitude(Double altitude) {
        this.altitude = altitude;
    }

    public Coordinate longitude(Double longitude) {
        this.longitude = longitude;
        return this;
    }

    public Coordinate latitude(Double latitude) {
        this.latitude = latitude;
        return this;
    }

    public Coordinate altitude(Double altitude) {
        this.altitude = altitude;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof Coordinate)) {
            return false;
        }
        Coordinate coordinate = (Coordinate) o;
        return Objects.equals(longitude, coordinate.longitude) && Objects.equals(latitude, coordinate.latitude) && Objects.equals(altitude, coordinate.altitude);
    }

    @Override
    public int hashCode() {
        return Objects.hash(longitude, latitude, altitude);
    }

    @Override
    public String toString() {
        return "{" +
            " longitude='" + getLongitude() + "'" +
            ", latitude='" + getLatitude() + "'" +
            ", altitude='" + getAltitude() + "'" +
            "}";
    }
}